home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 5 / BBS in a Box -Volume V (BBS in a Box) (April 1992).iso / Files / Word / A-Ad / Acius Tech Note 7 < prev    next >
Encoding:
Text File  |  1987-10-16  |  4.8 KB  |  111 lines  |  [TEXT/MSWD]

  1. ____________________________________________________________________
  2.  
  3. 4th Dimension Technical Notes
  4.  
  5. #7    Loading 4th Dimension's Scrollable Area Variable
  6.  
  7. Written by Ron Dell'Aquila    July 22, 1987
  8.  
  9. Published    August 1, 1987
  10. ____________________________________________________________________
  11.  
  12. This technote describes how to load a scrollable area variable with formatted 
  13. information.
  14. ___________________________________________________________
  15.  
  16. When using the scrollable area variables with 4th Dimension, you can simultaneously view the 
  17. contents of more than one list per input layout at the same time.  Scrollable areas offer the user 
  18. the ability to position the highlighted row anywhere in the scrollable region as well as decide 
  19. where the end of the scrollable information will be under program control .  
  20.  
  21.                                                        
  22.  
  23. In the above illustration, the scrollable area is called "vExpenses".  
  24.  
  25.  
  26. Initially define a scrollable area by creating a variable with the attribute "Scrollable Area" onto 
  27. your layout.  In this example, the variable is named "vExpenses".
  28.  
  29. To load the array, create a WHILE loop where both the array pointer and current record pointer 
  30. both increment for each iteration of the loop.
  31.  
  32. In the above example, notice there are 6 fields of information displayed for each line of the array.  
  33. Each field for every represented record must be concatenated together to form the contents of  
  34. each line of the array.  
  35.  
  36. Scrollable areas do not currently honor the TAB (CHAR(09)) horizontal position character, so it is 
  37. up to the user to position the information so it 'loooks goood.'  The formatting is controlled entirely 
  38. by the field formatting statements STRING and SUBSTRING functions in conjunction with a 
  39. monospaced character font such as Courier.
  40.  
  41. continued...
  42. #7:  Loading 4th Dimension's Scrollable Area Variable                                           Page #p of 2
  43.  
  44. #7:  Loading 4th Dimension's Scrollable Area Variable                                           Page #p of 2
  45.     
  46.  
  47.  
  48. MESSAGES OFF
  49. ALL RECORDS([Expenses])
  50.    `Find all the RECEIPTS which belong to the current TRIP and match the desired ran
  51. SEARCH BY INDEX([Expenses]TripNo=[Trip]TripNumber;[Expenses]Receipt No±0;vLastRecNo)
  52.    `Initilize the line index pointer
  53. i:=1
  54. vSpace:=" "*2
  55.    `Begin the scrollable area loader loop
  56. While (Not(End selection([Expenses]))
  57.      `Create array elements to be used for each row
  58.      `Note each following element must be of a consistant length regardless of it
  59.   vExpenses:=String([Expenses]Receipt No;"000")
  60.      `Convert boolean field REIMBURSEABLE to display either "Yes" or "No", 3 chars in length
  61.   vRemb:=Substring("YesNo ";[Expenses]Reimburseable*4;3)
  62.      `date field to be 10 characters in length
  63.   vDate:=Substring(String([Expenses]Expense Date)+(" "*10);1;10)
  64.      `catagory field to be 15 charactersin length
  65.   vCatagory:=Substring([Expenses]Category+(" "*15);1;15)
  66.      `description field to be 20 characters in length
  67.   vDesc:=Substring([Expenses]Description+(" "*20);1;20)
  68.      `convert the numeric AMOUNT field into a formatted string variable
  69.   vActlAmount:=String([Expenses]Amount;"$#,###.00")
  70.      `right justify the string of AMOUNT.  Stuff spaces before the amount.
  71.   vAmount:=(Substring(" "*10;1;10-Length(vActlAmount))+(vActlAmount))
  72.      `concantenate the above elements for each value of index {i}
  73.   vExpenses{i}:=vExpenses+vSpace+vRemb+vSpace+vDate+vSpace+vCatagory+vSpace+vDesc+vAmount
  74.      `increment index i
  75.   i:=i+1
  76.      `load the next record in the current selection
  77.   NEXT RECORD([Expenses])
  78.      `repeat until there are no more records in the current selection
  79. End while 
  80.    `define the numberof rows to be visible in the array: store the value in array element{0}
  81. vExpenses{0}:=i-1
  82.    `highlight the first row in the array
  83. vExpenses:=1
  84. MESSAGES ON
  85.  
  86. To define how many lines are to be in the scrollable area, assign the desired value to the variable 
  87. "vExpenses{0}", usually done after the loading process.
  88.  
  89. To Determine which line will be highlighted after loading the array, assign the row number desired 
  90. to the variable "vExpenses".  Simmilarly, if you want to read which line is highlighted, read the 
  91. value of "vExpenses".
  92.  
  93. Additionally, if you would like to display data from the selected row in an on screen variable, just 
  94. assign a variable the contents of vExpenses{vExpenses}.  For example: 
  95. vDisplay:=vExpenses{vExpenses}.
  96.  
  97. Using the techniques outlined in 4D Technote #9, it is possible to detect where a double click has 
  98. occurred within the scrollable area.
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105. #7:  Loading 4th Dimension's Scrollable Area Variable                                           Page #p of 2
  106.     
  107.  
  108.  
  109.  
  110.